package com.own.business.level.entity.bo;

import com.own.business.level.entity.po.LevelUserHistory;
import com.own.component.common.base.entity.BaseBo;
import com.own.constant.ConstantBeanSuffix;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;

import java.time.LocalDate;

/**
 * LevelUserHistoryBo
 *
 * @author chenxueli
 * @date 2022-07-25 10:13:00
 */
@ApiModel("用户经验获取流水" + ConstantBeanSuffix.BO)
@Getter
@Setter
@ToString
@Accessors(chain = true)
@AllArgsConstructor
@NoArgsConstructor
public class LevelUserHistoryBo extends BaseBo<LevelUserHistory> {

    @ApiModelProperty("用户id")
    private Long userId;

    @ApiModelProperty("操作前经验")
    private Integer beforeExp;

    @ApiModelProperty("操作后经验")
    private Integer afterExp;

    @ApiModelProperty("获得的经验")
    private Integer exp;

    @ApiModelProperty("经验信息描述")
    private String content;

    @ApiModelProperty("经验类型")
    private String type;

    @ApiModelProperty("操作的日期")
    private LocalDate operateDate;

    @ApiModelProperty("连续次数")
    private Integer consecutive;

    /**
     * 转持久化对象
     *
     * @param entity 原持久化对象
     * @return 持久化对象
     */
    @Override
    public LevelUserHistory toPo(LevelUserHistory entity) {
        if (entity == null) {
            entity = new LevelUserHistory();
        }
        entity.setFkUserId(this.userId);
        entity.setBeforeExp(this.beforeExp);
        entity.setAfterExp(this.afterExp);
        entity.setExp(this.exp);
        entity.setContent(this.content);
        entity.setType(this.type);
        entity.setOperateDate(this.operateDate);
        entity.setConsecutive(this.consecutive);
        return super.toPo(entity);
    }
}
